package mysql

import (
	"beergo/lib/tool"
	"fmt"
)

func CreateAuth(creator *Creator) {
	data := twigger.Render("/mysql/auth.twig", creator)
	createAuthFile(creator, []byte(data))
}

func createAuthFile(c *Creator, content []byte) {
	path := fmt.Sprintf(
		"%s/app/%s/conf/auth/%s.go",
		root, c.Table.Path, c.Table.Name)
	if !tool.FileExist(path) {
		tool.CreateFile(path, content)
	}
}
